package com.school.revervationSys.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.school.revervationSys.entity.TestQuestion;
import com.school.revervationSys.mapper.TestQuestionMapper;
import com.school.revervationSys.service.TestQuestionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TestQuestionServiceImpl  extends ServiceImpl<TestQuestionMapper, TestQuestion> implements TestQuestionService {



    public boolean addTestQuestion(TestQuestion testQuestion){

       return this.save(testQuestion);
    }


    public boolean updateTestQuestion(TestQuestion testQuestion){

        return this.updateById(testQuestion);
    }

    public boolean delTestQuestion(Integer testQuestionId){

        return this.removeById(testQuestionId);
    }

    public TestQuestion testQuestionInfo(Integer testQuestionId){

        return this.getById(testQuestionId);
    }

    public boolean batchDelete(List<Integer> testQuestionIds){

        return this.removeByIds(testQuestionIds);
    }

    public List<TestQuestion> questionList(Integer testManageId){

        List<TestQuestion> list = this.list(
                new QueryWrapper<TestQuestion>()
                        .lambda()
                        .eq(testManageId != null, TestQuestion::getTestManageId, testManageId));

        return list;

    }




}
